{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport BodyContext from \"../context/BodyContext\";\nimport HoverContext from \"../context/HoverContext\";\nimport PerfContext from \"../context/PerfContext\";\nimport ResizeContext from \"../context/ResizeContext\";\nimport TableContext from \"../context/TableContext\";\nimport { useContextSelector } from \"../ContextSelector\";\nimport useFlattenRecords from \"../hooks/useFlattenRecords\";\nimport { getColumnsKey } from \"../utils/valueUtil\";\nimport BodyRow from \"./BodyRow\";\nimport ExpandedRow from \"./ExpandedRow\";\nimport MeasureRow from \"./MeasureRow\";\nfunction Body(_ref) {\n  var data = _ref.data,\n    getRowKey = _ref.getRowKey,\n    measureColumnWidth = _ref.measureColumnWidth,\n    expandedKeys = _ref.expandedKeys,\n    onRow = _ref.onRow,\n    rowExpandable = _ref.rowExpandable,\n    emptyNode = _ref.emptyNode,\n    childrenColumnName = _ref.childrenColumnName;\n  var onColumnResize = useContextSelector(ResizeContext, 'onColumnResize');\n  var _useContextSelector = useContextSelector(TableContext, ['prefixCls', 'getComponent']),\n    prefixCls = _useContextSelector.prefixCls,\n    getComponent = _useContextSelector.getComponent;\n  var flattenColumns = useContextSelector(BodyContext, 'flattenColumns');\n  var flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey); // =================== Performance ====================\n\n  var perfRef = React.useRef({\n    renderWithProps: false\n  }); // ====================== Hover =======================\n\n  var _React$useState = React.useState(-1),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    startRow = _React$useState2[0],\n    setStartRow = _React$useState2[1];\n  var _React$useState3 = React.useState(-1),\n    _React$useState4 = _slicedToArray(_React$useState3, 2),\n    endRow = _React$useState4[0],\n    setEndRow = _React$useState4[1];\n  var onHover = React.useCallback(function (start, end) {\n    setStartRow(start);\n    setEndRow(end);\n  }, []); // ====================== Render ======================\n\n  var bodyNode = React.useMemo(function () {\n    var WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');\n    var trComponent = getComponent(['body', 'row'], 'tr');\n    var tdComponent = getComponent(['body', 'cell'], 'td');\n    var thComponent = getComponent(['body', 'cell'], 'th');\n    var rows;\n    if (data.length) {\n      rows = flattenData.map(function (item, idx) {\n        var record = item.record,\n          indent = item.indent,\n          renderIndex = item.index;\n        var key = getRowKey(record, idx);\n        return /*#__PURE__*/React.createElement(BodyRow, {\n          key: key,\n          rowKey: key,\n          record: record,\n          recordKey: key,\n          index: idx,\n          renderIndex: renderIndex,\n          rowComponent: trComponent,\n          cellComponent: tdComponent,\n          scopeCellComponent: thComponent,\n          expandedKeys: expandedKeys,\n          onRow: onRow,\n          getRowKey: getRowKey,\n          rowExpandable: rowExpandable,\n          childrenColumnName: childrenColumnName,\n          indent: indent\n        });\n      });\n    } else {\n      rows = /*#__PURE__*/React.createElement(ExpandedRow, {\n        expanded: true,\n        className: \"\".concat(prefixCls, \"-placeholder\"),\n        prefixCls: prefixCls,\n        component: trComponent,\n        cellComponent: tdComponent,\n        colSpan: flattenColumns.length,\n        isEmpty: true\n      }, emptyNode);\n    }\n    var columnsKey = getColumnsKey(flattenColumns);\n    return /*#__PURE__*/React.createElement(WrapperComponent, {\n      className: \"\".concat(prefixCls, \"-tbody\")\n    }, measureColumnWidth && /*#__PURE__*/React.createElement(MeasureRow, {\n      prefixCls: prefixCls,\n      columnsKey: columnsKey,\n      onColumnResize: onColumnResize\n    }), rows);\n  }, [data, prefixCls, onRow, measureColumnWidth, expandedKeys, getRowKey, getComponent, emptyNode, flattenColumns, childrenColumnName, onColumnResize, rowExpandable, flattenData]);\n  return /*#__PURE__*/React.createElement(PerfContext.Provider, {\n    value: perfRef.current\n  }, /*#__PURE__*/React.createElement(HoverContext.Provider, {\n    value: {\n      startRow: startRow,\n      endRow: endRow,\n      onHover: onHover\n    }\n  }, bodyNode));\n}\nvar MemoBody = /*#__PURE__*/React.memo(Body);\nMemoBody.displayName = 'Body';\nexport default MemoBody;","map":{"version":3,"names":["_slicedToArray","React","BodyContext","HoverContext","PerfContext","ResizeContext","TableContext","useContextSelector","useFlattenRecords","getColumnsKey","BodyRow","ExpandedRow","MeasureRow","Body","_ref","data","getRowKey","measureColumnWidth","expandedKeys","onRow","rowExpandable","emptyNode","childrenColumnName","onColumnResize","_useContextSelector","prefixCls","getComponent","flattenColumns","flattenData","perfRef","useRef","renderWithProps","_React$useState","useState","_React$useState2","startRow","setStartRow","_React$useState3","_React$useState4","endRow","setEndRow","onHover","useCallback","start","end","bodyNode","useMemo","WrapperComponent","trComponent","tdComponent","thComponent","rows","length","map","item","idx","record","indent","renderIndex","index","key","createElement","rowKey","recordKey","rowComponent","cellComponent","scopeCellComponent","expanded","className","concat","component","colSpan","isEmpty","columnsKey","Provider","value","current","MemoBody","memo","displayName"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-table/es/Body/index.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport BodyContext from \"../context/BodyContext\";\nimport HoverContext from \"../context/HoverContext\";\nimport PerfContext from \"../context/PerfContext\";\nimport ResizeContext from \"../context/ResizeContext\";\nimport TableContext from \"../context/TableContext\";\nimport { useContextSelector } from \"../ContextSelector\";\nimport useFlattenRecords from \"../hooks/useFlattenRecords\";\nimport { getColumnsKey } from \"../utils/valueUtil\";\nimport BodyRow from \"./BodyRow\";\nimport ExpandedRow from \"./ExpandedRow\";\nimport MeasureRow from \"./MeasureRow\";\n\nfunction Body(_ref) {\n  var data = _ref.data,\n      getRowKey = _ref.getRowKey,\n      measureColumnWidth = _ref.measureColumnWidth,\n      expandedKeys = _ref.expandedKeys,\n      onRow = _ref.onRow,\n      rowExpandable = _ref.rowExpandable,\n      emptyNode = _ref.emptyNode,\n      childrenColumnName = _ref.childrenColumnName;\n  var onColumnResize = useContextSelector(ResizeContext, 'onColumnResize');\n\n  var _useContextSelector = useContextSelector(TableContext, ['prefixCls', 'getComponent']),\n      prefixCls = _useContextSelector.prefixCls,\n      getComponent = _useContextSelector.getComponent;\n\n  var flattenColumns = useContextSelector(BodyContext, 'flattenColumns');\n  var flattenData = useFlattenRecords(data, childrenColumnName, expandedKeys, getRowKey); // =================== Performance ====================\n\n  var perfRef = React.useRef({\n    renderWithProps: false\n  }); // ====================== Hover =======================\n\n  var _React$useState = React.useState(-1),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      startRow = _React$useState2[0],\n      setStartRow = _React$useState2[1];\n\n  var _React$useState3 = React.useState(-1),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      endRow = _React$useState4[0],\n      setEndRow = _React$useState4[1];\n\n  var onHover = React.useCallback(function (start, end) {\n    setStartRow(start);\n    setEndRow(end);\n  }, []); // ====================== Render ======================\n\n  var bodyNode = React.useMemo(function () {\n    var WrapperComponent = getComponent(['body', 'wrapper'], 'tbody');\n    var trComponent = getComponent(['body', 'row'], 'tr');\n    var tdComponent = getComponent(['body', 'cell'], 'td');\n    var thComponent = getComponent(['body', 'cell'], 'th');\n    var rows;\n\n    if (data.length) {\n      rows = flattenData.map(function (item, idx) {\n        var record = item.record,\n            indent = item.indent,\n            renderIndex = item.index;\n        var key = getRowKey(record, idx);\n        return /*#__PURE__*/React.createElement(BodyRow, {\n          key: key,\n          rowKey: key,\n          record: record,\n          recordKey: key,\n          index: idx,\n          renderIndex: renderIndex,\n          rowComponent: trComponent,\n          cellComponent: tdComponent,\n          scopeCellComponent: thComponent,\n          expandedKeys: expandedKeys,\n          onRow: onRow,\n          getRowKey: getRowKey,\n          rowExpandable: rowExpandable,\n          childrenColumnName: childrenColumnName,\n          indent: indent\n        });\n      });\n    } else {\n      rows = /*#__PURE__*/React.createElement(ExpandedRow, {\n        expanded: true,\n        className: \"\".concat(prefixCls, \"-placeholder\"),\n        prefixCls: prefixCls,\n        component: trComponent,\n        cellComponent: tdComponent,\n        colSpan: flattenColumns.length,\n        isEmpty: true\n      }, emptyNode);\n    }\n\n    var columnsKey = getColumnsKey(flattenColumns);\n    return /*#__PURE__*/React.createElement(WrapperComponent, {\n      className: \"\".concat(prefixCls, \"-tbody\")\n    }, measureColumnWidth && /*#__PURE__*/React.createElement(MeasureRow, {\n      prefixCls: prefixCls,\n      columnsKey: columnsKey,\n      onColumnResize: onColumnResize\n    }), rows);\n  }, [data, prefixCls, onRow, measureColumnWidth, expandedKeys, getRowKey, getComponent, emptyNode, flattenColumns, childrenColumnName, onColumnResize, rowExpandable, flattenData]);\n  return /*#__PURE__*/React.createElement(PerfContext.Provider, {\n    value: perfRef.current\n  }, /*#__PURE__*/React.createElement(HoverContext.Provider, {\n    value: {\n      startRow: startRow,\n      endRow: endRow,\n      onHover: onHover\n    }\n  }, bodyNode));\n}\n\nvar MemoBody = /*#__PURE__*/React.memo(Body);\nMemoBody.displayName = 'Body';\nexport default MemoBody;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,YAAY,MAAM,yBAAyB;AAClD,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,aAAa,MAAM,0BAA0B;AACpD,OAAOC,YAAY,MAAM,yBAAyB;AAClD,SAASC,kBAAkB,QAAQ,oBAAoB;AACvD,OAAOC,iBAAiB,MAAM,4BAA4B;AAC1D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,OAAOC,OAAO,MAAM,WAAW;AAC/B,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,UAAU,MAAM,cAAc;AAErC,SAASC,IAAI,CAACC,IAAI,EAAE;EAClB,IAAIC,IAAI,GAAGD,IAAI,CAACC,IAAI;IAChBC,SAAS,GAAGF,IAAI,CAACE,SAAS;IAC1BC,kBAAkB,GAAGH,IAAI,CAACG,kBAAkB;IAC5CC,YAAY,GAAGJ,IAAI,CAACI,YAAY;IAChCC,KAAK,GAAGL,IAAI,CAACK,KAAK;IAClBC,aAAa,GAAGN,IAAI,CAACM,aAAa;IAClCC,SAAS,GAAGP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